Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding handling for errors parsing grant round funds #621

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

phutchins
Copy link
Contributor

Closes #616

@jjwoz
Copy link
Contributor

jjwoz commented Jan 20, 2022

@phutchins it looks like the tests have failed for linting

@phutchins
Copy link
Contributor Author

Replaced undefined return with empty object instead which appears to be passing linting.

} catch {
// If parsing funds for the round fails, ignore the round
console.log('Failed to parse funds for round');
return {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We normally return a grant round which has fields that are expected to be defined based on the type definitions, which aren't necessarily reflected by the LocalForage abstractions—are you sure returning an empty grantRound object like this is safe and won't cause other issues?

Copy link
Member

@metafraction metafraction Jan 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mds1 what issues do you anticipate? I tested it out and seems to be fixing the error (hanging load) we're seeing, but there could be some unforeseen issues

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There could also be a more gracious way of fixing the error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mds1 there are a couple of places we use this method like where we update grant rounds.

We should set a standard way of doing this (if we have not already) throughout our codebase. I.E. if you request an object from a method and it does not exist, fails to retrieve, or has errors, we should consistently return the same thing across the board. That way anywhere we are implementing that method, we can handle the results consistently.

Copy link
Member

@metafraction metafraction left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and fixes the hanging loading spinner. I was curious why you needed to return. I'm assuming it's to exit out of the function if error is caught. Returning an empty object is probably okay for that.

nit: maybe use console.error instead of console.log?

@phutchins
Copy link
Contributor Author

Going to move forward with merging this and we can add an issue for ensuring that we handle errors processing grant rounds consistently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Site not working
5 participants